<template>
    <div class="streaming">
        <!-- 主播 -->
        <!-- 以下放入组件 -->
        <div class="SearchResult-content">
            <div class="SearchResultAll">
                <!-- 上 -->
                <div class="SearchResultAllAnchor">
                    <h2 class="SearchResultAllAnchor-title">
                        <span class="SearchResultAllAnchor-titleIcon"></span>
                        <span class="SearchResultAllAnchor-titleName">主播</span>
                        <div class="SearchResultAllAnchor-titleMore" @click="more">更多</div>
                    </h2>
                    <div class="SearchResultAllAnchor-show">
                        <div class="SearchResultAllAnchor-showItem" v-for="(item,index) in arr" :key="index"
                            @click="fun(item.roomId)">
                            <div class="SearchResultAllAnchor-showItemAnchor"><img :src="item.avatar" alt="">
                                <div class="SearchResultAllAnchor-showItemLive"></div>
                            </div>
                            <div class="SearchResultAllAnchor-showItemNickname">{{item.nickname}}</div>
                            <div class="SearchResultAllAnchor-showItemFllow">{{item.follow}}</div>
                        </div>
                    </div>
                </div>
                <!-- 下 -->
                <div class="SearchResultAllLive">
                    <h2 class="SearchResultAllAnchor-title">
                        <span class="SearchResultAllAnchor-titleIcon"></span>
                        <span class="SearchResultAllAnchor-titleName">直播</span>
                        <div class="SearchResultAllAnchor-titleMore" @click="more2">更多</div>
                    </h2>
                    <div class="SearchResultAllLive-content">
                        <div class="NormalRoomItem" v-for="(itemtow,index) in mylist" :key="index"
                            @click="func(itemtow.roomId)">
                            <div class="NormalRoomItem-show">
                                <div class="NormalRoomItem-showImg">
                                    <img :src="itemtow.roomSrc" alt="">
                                </div>
                                <div class="NormalRoomItem-showHot">
                                    <i class="NormalRoomItem-showHotIcon"></i>
                                    <span class="NormalRoomItem-showHotNum">{{itemtow.hn}}</span>
                                </div>
                                <div class="NormalRoomItem-showAnchor">
                                    <i class="NormalRoomItem-showAnchorIcon"></i>
                                    <span class="NormalRoomItem-showAnchorName">{{itemtow.nickname}}</span>
                                </div>
                            </div>
                            <div class="NormalRoomItem-title">{{itemtow.roomName}}}</div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</template>
<script>

    export default {
        name: 'streaming',
        data() {
            return {
                arr: [],
                mylist: [],
                key: [],
                num: [],
                zive: [],
                zivc: []
            }
        },
        created() {
            // this.$emit("fu", this.num);
            this.num = this.$route.query.index
            this.zive = encodeURI(this.$route.query.zive)
            this.send(this.zive, this.num)
        },
        methods: {
            fun(rid) {
                this.$router.push({
                    path: '/detlete',
                    query: {
                        rid: rid
                    }
                })
            },
            func(rid) {
                this.$router.push({
                    path: '/detlete',
                    query: {
                        rid: rid
                    }
                })
            },
            send(zive, num) {
                this.$http.get(`/api/search/getData?sk=${zive}&type=${num}&sort=1&limit=20&offset=0`).then(res => {
                    this.arr = res.data.data.anchor
                    this.mylist = res.data.data.live
                })
            },
            more() {
                this.$router.push({
                        path: '/result/anchor',
                        query: {
                            index: 3,
                            zive:this.$route.query.zive
                        }
                })
            },
            more2() {
                this.$router.push({
                        path: '/result/entire',
                        query: {
                            index: 2,
                            zive:this.$route.query.zive
                        }
                })
            }
        },
    }
</script>
<style scoped>
    /* 直播 */
    .SearchResult-content {
        position: absolute;
        top: 70px;
        left: 0;
        bottom: 0;
        width: 100%;
        -webkit-overflow-scrolling: touch;
        background: #fff;
    }

    .SearchResultAll {
        width: 100%;
        overflow: hidden;
        background: #fff;
    }

    /* 上 */
    .SearchResultAllAnchor {
        margin-top: 10px;
        width: 100%;
        background: #fff;
    }

    .SearchResultAllAnchor-title {
        position: relative;
        display: -webkit-box;
        display: -webkit-flex;
        display: -moz-box;
        display: -ms-flexbox;
        display: flex;
        -webkit-box-align: center;
        -webkit-align-items: center;
        -moz-box-align: center;
        -ms-flex-align: center;
        align-items: center;
        -webkit-box-sizing: border-box;
        -moz-box-sizing: border-box;
        box-sizing: border-box;
        padding-left: 5px;
        width: 100%;
        height: 44px;
    }

    .SearchResultAllAnchor-titleIcon {
        display: block;
        margin-right: 10px;
        width: 5px;
        height: 18px;
        background: #ff6d00;
        -webkit-border-radius: 2.5px;
        -moz-border-radius: 2.5px;
        border-radius: 2.5px;
    }

    .SearchResultAllAnchor-titleName {
        display: block;
        height: 44px;
        line-height: 44px;
        font-size: 16px;
        color: #333;
        font-weight: 400;
    }

    .SearchResultAllAnchor-titleMore {
        position: absolute;
        top: 0;
        right: 5px;
        padding-right: 18px;
        height: 100%;
        line-height: 44px;
        font-size: 13px;
        color: #999;
        font-weight: 400;
        background: url(https://shark2.douyucdn.cn/front-publish/m-douyu-v3-master/assets/images/icon-more_6c08756.png) no-repeat;
        -webkit-background-size: 13px 13px;
        -moz-background-size: 13px 13px;
        background-size: 13px 13px;
        background-position: 100%;
    }

    .SearchResultAllAnchor-show {

        padding-bottom: 10px;
        width: 100%;
        overflow: hidden;

    }

    .SearchResultAllAnchor-showItem {
        position: relative;
        float: left;
        display: -webkit-box;
        display: -webkit-flex;
        display: -moz-box;
        display: -ms-flexbox;
        display: flex;
        -webkit-box-orient: vertical;
        -webkit-box-direction: normal;
        -webkit-flex-direction: column;
        -moz-box-orient: vertical;
        -moz-box-direction: normal;
        -ms-flex-direction: column;
        flex-direction: column;
        -webkit-box-align: center;
        -webkit-align-items: center;
        -moz-box-align: center;
        -ms-flex-align: center;
        align-items: center;
        width: 25%;
        height: 123px;
    }

    .SearchResultAllAnchor-showItemAnchor {
        position: relative;
        width: 70px;
        height: 70px;
        -webkit-border-radius: 4px;
        -moz-border-radius: 4px;
        border-radius: 4px;
        overflow: hidden;
    }

    .SearchResultAllAnchor-showItemAnchor img {
        height: 100%;
        width: 100%;
    }

    .SearchResultAllAnchor-showItemNickname {
        margin-top: 8px;
        width: 100%;
        line-height: 1.15;
        text-align: center;
        font-size: 12px;
        color: #333;
        overflow: hidden;
        -o-text-overflow: ellipsis;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .SearchResultAllAnchor-showItemFllow {
        margin-top: 5px;
        width: 100%;
        line-height: 1.15;
        text-align: center;
        font-size: 12px;
        color: #999;
        overflow: hidden;
        -o-text-overflow: ellipsis;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    /* 下 */
    .SearchResultAllLive {
        margin-top: 10px;
        width: 100%;
        background: #fff;
    }

    .SearchResultAllLive-content {
        -webkit-box-sizing: border-box;
        -moz-box-sizing: border-box;
        box-sizing: border-box;
        padding-left: 5px;
        width: 100%;
        overflow: hidden;
    }

    .NormalRoomItem {
        float: left;
        -webkit-box-sizing: border-box;
        -moz-box-sizing: border-box;
        box-sizing: border-box;
        padding: 0 5px 5px 0;
        width: 50%
    }


    .NormalRoomItem-show {
        -webkit-border-radius: 4px;
        -moz-border-radius: 4px;
        border-radius: 4px;
        width: 100%;
        height: 100%;
        position: absolute;
        top: 0;
        left: 0;
        z-index: 1;
        overflow: hidden;
    }

    .NormalRoomItem-show img {
        border-radius: 4px;
        width: 100%;
        height: 100%;
    }

    .NormalRoomItem-showHot {
        position: absolute;
        top: 0;
        left: 0;
        z-index: 10;
        display: -webkit-box;
        display: -webkit-flex;
        display: -moz-box;
        display: -ms-flexbox;
        display: flex;
        -webkit-box-pack: end;
        -webkit-justify-content: flex-end;
        -moz-box-pack: end;
        -ms-flex-pack: end;
        justify-content: flex-end;
        -webkit-box-align: center;
        -webkit-align-items: center;
        -moz-box-align: center;
        -ms-flex-align: center;
        align-items: center;
        -webkit-box-sizing: border-box;
        -moz-box-sizing: border-box;
        box-sizing: border-box;
        padding-right: 5px;
        width: 100%;
        height: 18px;
        background: url(https://shark2.douyucdn.cn/front-publish/m-douyu-v3-master/assets/images/bg-shadow_e60f214.png) no-repeat;
        -webkit-background-size: 100% 100%;
        -moz-background-size: 100% 100%;
        background-size: 100% 100%;
        -webkit-border-radius: 4px 4px 0 0;
        -moz-border-radius: 4px 4px 0 0;
        border-radius: 4px 4px 0 0;
    }

    .NormalRoomItem-showHotIcon {
        display: block;
        margin-right: 3px;
        width: 11px;
        height: 11px;
        background: url(https://shark2.douyucdn.cn/front-publish/m-douyu-v3-master/assets/images/hotnum_6b05e5d.png) no-repeat;
        -webkit-background-size: 100% 100%;
        -moz-background-size: 100% 100%;
        background-size: 100% 100%;
    }

    .NormalRoomItem-show {
        position: relative;
        -webkit-border-radius: 4px;
        -moz-border-radius: 4px;
        border-radius: 4px;
        width: 100%;
        overflow: hidden;
        background: url(https://shark2.douyucdn.cn/front-publish/m-douyu-v3-master/assets/images/list-item-def-thumb_b10bbe8.png) no-repeat;
        -webkit-background-size: 100% 100%;
        -moz-background-size: 100% 100%;
        background-size: 100% 100%;

    }

    .NormalRoomItem-showHotNum {
        display: block;
        height: 100%;
        line-height: 18px;
        font-size: 10px;
        color: #fff;
    }

    .NormalRoomItem-showAnchor {
        position: absolute;
        left: 0;
        bottom: 0;
        z-index: 10;
        display: -webkit-box;
        display: -webkit-flex;
        display: -moz-box;
        display: -ms-flexbox;
        display: flex;
        -webkit-box-pack: start;
        -webkit-justify-content: flex-start;
        -moz-box-pack: start;
        -ms-flex-pack: start;
        justify-content: flex-start;
        -webkit-box-align: center;
        -webkit-align-items: center;
        -moz-box-align: center;
        -ms-flex-align: center;
        align-items: center;
        -webkit-box-sizing: border-box;
        -moz-box-sizing: border-box;
        box-sizing: border-box;
        padding: 0 5px;
        -webkit-border-radius: 0 0 4px 4px;
        -moz-border-radius: 0 0 4px 4px;
        border-radius: 0 0 4px 4px;
        width: 100%;
        height: 18px;
        overflow: hidden;
        background: -webkit-linear-gradient(transparent, rgba(0, 0, 0, .8));
        background: -webkit-gradient(linear, left top, left bottom, from(transparent), to(rgba(0, 0, 0, .8)));
        background: -moz- oldlinear-gradient(transparent, rgba(0, 0, 0, .8));
        background: -o-linear-gradient(transparent, rgba(0, 0, 0, .8));
        background: linear-gradient(transparent, rgba(0, 0, 0, .8));
    }

    .NormalRoomItem-showAnchorIcon {
        display: block;
        width: 11px;
        height: 12px;
        margin-right: 3px;
        background: url(https://shark2.douyucdn.cn/front-publish/m-douyu-v3-master/assets/images/iconfont-wo_fdcada2.png) no-repeat;
        -webkit-background-size: 100% 100%;
        -moz-background-size: 100% 100%;
        background-size: 100% 100%;
    }

    .NormalRoomItem-showAnchorName {
        display: block;
        -webkit-box-flex: 1;
        -webkit-flex: 1;
        -moz-box-flex: 1;
        -ms-flex: 1;
        flex: 1;
        height: 18px;
        line-height: 18px;
        font-size: 10px;
        color: #fff;
        overflow: hidden;
        -o-text-overflow: ellipsis;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .NormalRoomItem-title {
        width: 100%;
        height: 27px;
        line-height: 27px;
        font-size: 12px;
        color: #333;
        overflow: hidden;
        -o-text-overflow: ellipsis;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
</style>